home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / art&graf.ix / art-5471 / doc / util.txt < prev   
Text File  |  1995-08-29  |  10KB  |  237 lines

  1.    MpegUtil version 1.0
  2.  
  3.   Developed by, and Copyright Phillip Lougher 1995.
  4.  
  5. MpegUtil is an analysis and edit program for MPEG-1 video files. One or
  6. more input files can be specified, and the program will give a full range of
  7. statistics about the files.  In addition to analysis, the program can
  8. perform simple editing operations: file concatenation, clip extraction,
  9. B and P frame removal.
  10.  
  11. The information generated includes a listing of all the frames and Groups of 
  12. Pictures (GoP) contained within the input files.  For frames, this includes
  13. their type (I, P, B) and their frame index in the file.  For GoPs this shows
  14. the Gop start and end in the file, and whether they are Open, Closed, or
  15. have the Broken link set.  This listing is given in both decode (the order
  16. of frame appearance within the file) and display order.
  17.  
  18. A summary of various statistical information is generated, this shows:
  19. frame width and height, pixel aspect ratio, picture rate/bit rate per second,
  20. count of frames (I, P, B and total frames), Gops (Closed and Open),
  21. average byte size and compression ratio of I, P and B frames etc.
  22.  
  23. In addition, some limited MPEG-1 conformance checks are made, this includes
  24. checks on the type of frames at GoP start and ends in both decode and
  25. display order, and checks on the correctness of frame temporal reference
  26. counts.
  27.  
  28. USAGE
  29. =====
  30.  
  31. SYNTAX: mpegUtil mpeg_file1 mpeg_file2 ... [options]
  32.  
  33. Options are:
  34.     -full               Generate full MPEG file statistics
  35.     -frames n           Only read the first n frames from the input file(s)
  36.     -output filename    Write MPEG data to filename.  Most usefully used
  37.                         in conjunction with the following options
  38.     -start frame        Start frame display/output from this frame
  39.     -end frame          Stop frame display/output at this frame
  40.     -noP                Delete all P frames in output file.  All dependent
  41.                         B frames are also removed
  42.     -noB                Delete all B frames in output file
  43.     -author             Where to send comments etc.
  44.  
  45.  
  46. The simplest usage is to type the program name and the input files on their
  47. own.  The following is a sample output, which serves to illustrate the
  48. output format.
  49.  
  50. ---------------------------------------------
  51. %mpegUtil mpeg.mpg
  52.  
  53. Parsing file mpeg.mpg.  Please wait...
  54. *IPBBPBBPBB*IBBPBBPBBPBB*IBBPBBPBBPBB*IBBPBBPBBPBB*IBBP
  55.  
  56.  
  57. MPEG file information summary
  58. -----------------------------
  59.  
  60. Frame sequence (decode order)
  61.  ||   0   1   2   3   4   5   6   7   8   9 ||  10  11  12  13  14  15  16
  62.  ||   I   P   B   B   P   B   B   P   B   B ||   I   B   B   P   B   B   P
  63.  
  64.   17  18  19  20  21 ||  22  23  24  25  26  27  28  29  30  31  32  33 ||
  65.    B   B   P   B   B ||   I   B   B   P   B   B   P   B   B   P   B   B ||
  66.  
  67.   34  35  36  37  38  39  40  41  42  43  44  45 ||  46  47  48  49
  68.    I   B   B   P   B   B   P   B   B   P   B   B ||   I   B   B   P
  69.  
  70. Frame sequence (display order)
  71.  ||   0   2   3   1   5   6   4   8   9   7 ||  11  12  10  14  15  13  17
  72.  ||   I   B   B   P   B   B   P   B   B   P ||   B   B   I   B   B   P   B
  73.  
  74.   18  16  20  21  19 ||  23  24  22  26  27  25  29  30  28  32  33  31 ||
  75.    B   P   B   B   P ||   B   B   I   B   B   P   B   B   P   B   B   P ||
  76.  
  77.   35  36  34  38  39  37  41  42  40  44  45  43 ||  47  48  46  49
  78.    B   B   I   B   B   P   B   B   P   B   B   P ||   B   B   I   P
  79.  
  80. Frame size: width 352, height 288
  81. Pixel aspect ratio (height to width) 1.000 Square pixels
  82. Picture rate: 25 frames per second
  83. Bit rate: 1700000 bits/s (207.52 Kbytes/s)
  84.  
  85. Total number of pictures in sequence 50
  86.     Made up of 5 I, 13 P and 32 B frames
  87. Total number of Groups of Pictures (random access points) 5
  88.     Made up of 5 closed, and 0 open GOPs
  89.  
  90. Uncompressed picture size 304128 bytes
  91. Average picture size 8602.34 bytes, 2.83% of uncompressed picture
  92. Average size of I frames 31589.60 bytes, 10.39% of uncompressed picture
  93. Average size of P frames 12769.00 bytes, 4.20% of uncompressed picture
  94. Average size of B frames 3317.87 bytes, 1.09% of uncompressed picture
  95. Modal average number of pictures per GOP 12 pictures, occurs 3 times
  96. Mean average number of pictures per GOP 10.00
  97. Average size of GOPs 86031.40
  98. --------------------------------------------------
  99.  
  100. The first part between the command line and "MPEG file information summary"
  101. is produced as the file is parsed.  The asterisks are printed every time
  102. a GoP start is found, and I, P or B is printed every time a frame is found.
  103. If the program detects any errors in the file, these are printed here.
  104.  
  105. The second part gives a listing of the frames and GoPs found.  The numbers 
  106. are the frame index within the file.  For the decode order, these should be
  107. consecutive.  For the display order, the numbers may not be consecutive,
  108. this indicates that frame reordering has taken place.  For example, the
  109. DISPLAY order sequence IBBBBPBBBBP, has a number of B frames dependent on P
  110. frames which occur in the future.  These P frames are reordered in DECODE
  111. order (the order they appear in the MPEG file), so that they appear before
  112. the B frames.  These appear in decode order as:
  113.  
  114. 0 1 2 3 4 5 6 7 8 9 10
  115. I P B B B B P B B B B
  116.  
  117. and in display order
  118.  
  119. 0 2 3 4 5 1 7 8 9 10 6
  120. I B B B B P B B B B  P
  121.  
  122. The bars (|) indicate the start of GoPs.  The exact form of the bars give 
  123. a visual indication of the type of Gop.  Closed GoPs are denoted by double
  124. bars ||, and open GoPs are denoted by single bars |.  Open GoPs which have
  125. their broken link set (this indicates that the GoP posses B frames which are
  126. dependent on the previous GoP, which is missing) are denoted by a Bar and a
  127. Plus, or |+.
  128.  
  129. MORE ADVANCED USE
  130. =================
  131.  
  132. The options.
  133.  
  134. -full
  135.  This generates a full listing of information as the file is being
  136.  parsed, instead of just printing GoP starts and frames.  This is
  137.  useful if you need to find out how many SEQUENCE HEADERS are
  138.  contained within the file, or need to know the exact length of a
  139.  GoP rather than the average length.
  140.  
  141. -frames n
  142.  If a file is many megabytes in size, it can be rather tedious to
  143.  wait for the program to process it completely, if you're only
  144.  interested in the first couple of hundred frames.  This allows
  145.  you to specify how many frames the program reads before it
  146.  stops parsing the file.  Note the program rounds the number up to
  147.  the nearest frame sequence, where a sequence is a set of reference
  148.  frames and their dependents (i.e. IPBBB in decode order is a
  149.  frame sequence).  This is to prevent the program reading a reordered
  150.  reference frame without reading the dependents.
  151.  
  152. -start frame &
  153. -end frame
  154.  (this describes their use in analysis mode only).  In many cases,
  155.  you may want the entire file to be parsed by the program, but
  156.  only want a small sample frame listing.  For example, in a
  157.  file containing 6,000 frames, you may want the statistics to be
  158.  based on the entire file, but only want frames 3,000 - 3,060 to be
  159.  listed.  In this case you would type mpegUtil mpeg.mpg -start 3000
  160.  -end 3060.
  161.  
  162.  
  163. MPEG FILE EDITING
  164. =================
  165.  
  166. The program can perform four editing operations: concatenation,
  167. clip extraction, B and P frame removal.  
  168.  
  169. Disclaimer: MPEG file editing is a difficult task, and it can only be
  170. performed where it has been provided for by the MPEG standard.  As
  171. stated by the standard, it can be difficult to end up with a file that
  172. complies with the requirements of the video buffering verifier (VBV).  This
  173. program sets/resets the Gop open/closed and broken link bits, and
  174. recomputes picture temporal reference counts as necessary. It does not,
  175. however, alter the VBV or bit rate fields.  If your file or player uses
  176. these fields (many do not) then things may choke on the edited output file.
  177. The author accepts no responsibility for the loss of any data through the
  178. use of this edit facility.
  179.  
  180. File concatenation
  181. ------------------
  182. This can be performed by simply specifying the desired output file on the
  183. command line, e.g.
  184.  
  185. %mpegUtil mpeg1.mpg mpeg2.mpg -output total.mpg
  186.  
  187. This will concatenate mpeg1.mpg and mpeg2.mpg into the one file total.mpg.
  188. This will normally only work if the two files are similar, i.e. have the
  189. same encoding characteristics.
  190.  
  191.  
  192. Clip extraction
  193. ---------------
  194. The extraction of a range of frames within a file can be performed using
  195. -start and -end in conjunction with -output, e.g.
  196.  
  197. %mpegUtil mpeg.mpg -start 200 -end 300 -output clip.mpg
  198.  
  199. This will save frames 200 - 300 to the file clip.mpg.  It is important
  200. to note that the program ROUNDS the specified frame numbers to the nearest
  201. useful frame, i.e. the -start frame is rounded up to the nearest I frame
  202. or GoP start (whichever is nearest).  The -end frame is rounded down to the
  203. end of the nearest dependent frame sequence (for example IPBBB decode order
  204. has 4 frames dependent on the I frame).
  205.  
  206. The -frames option can be used to restrict the number of frames parsed.
  207. This can be set to the count of the maximum frame to be extracted, e.g
  208. mpegUtil mpeg.mpg -start 30 -end 35 -frames 36 -output clip.mpg.
  209.  
  210. B and P frame removal
  211. ---------------------
  212. These options allow B and P frames to be removed from a file.  This can be
  213. useful to allow files to be replayed on players which only support I
  214. frames, or to reduce file size or CPU load etc.  The output file is
  215. specified using -output.
  216.  
  217. -noB removes all B frames within the file, or within the output clip if
  218. start and end are used.
  219.  
  220. -noP removes all P frames from a file or clip.  Any B frames which depend on
  221. a deleted P frame are also removed.
  222.  
  223. -noB -noP generates an I frame only file.
  224.  
  225. Please note: for constant bitrate files, removal of P and B frames
  226. will alter the file bitrate.  This may cause some players to choke on
  227. the edited output.
  228.  
  229.  
  230. AUTHOR INFORMATION
  231. ==================
  232.  
  233. This program was written by Phillip Lougher, January - March 1995.
  234.  
  235. If you have any comments on the program, like it, or find any bugs then please
  236. email me, phillip@comp.lancs.ac.uk.
  237.